import request from '@/router/axios';
import config from '@/config/website'

//项目开发阶段任务设置
//任务列表
export const getStageTaskList = (params) => {
  return request({
    url: '/api/hg-public/taskbooktask/page',
    method: 'get',
    params: {
      ...params
    }
  })
}
//根据项目编号获取责任部门下拉选
export const getProjDeparts = (params) => {
  return request({
    url: '/api/hg-public/taskbooktask/getMemberDept',
    method: 'get',
    params: {
      ...params
    }
  })
}
//新增开发阶段任务
export const addStageTask = (row) => {
  return request({
    url: '/api/hg-public/taskbooktask/save',
    method: 'post',
    data: row
  })
}

//删除开发阶段任务
export const removeStageTask = (ids) => {
  return request({
    url: '/api/hg-public/taskbooktask/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

//更新开发阶段任务
export const updateStageTask = (row) => {
  return request({
    url: '/api/hg-public/taskbooktask/submit',
    method: 'post',
    data: row
  })
}

//获取开发阶段任务详情
export const getStageTask = (id) => {
  return request({
    url: '/api/hg-public/taskbooktask/detail',
    method: 'get',
    params: {
      id
    }
  })
}

//获取开发阶段任务APQP文件列表
export const getAPQPDocs = (apqp) => {
  return request({
    url: '/api/hg-public/taskbooktask/viewapqp',
    method: 'get',
    params: {
      apqp,
    }
  })
}
export const stageTaskInforExport = (ids) => {
  window.location = `${config.exportUrl}/hg-public/taskbooktask?id=${ids}`;
}

